package com.ytxt.taskdemo.common.config.aotuConfigure;

import com.ytxt.taskdemo.common.config.TyydConfigurations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author xujunjie xujunjie@189read.com
 * @version V1.0
 * @Title: 自动装配
 * @Package
 * @Description: (用一句话描述该文件做什么)
 * @date
 */
@Configuration
@ConditionalOnMissingClass
@EnableConfigurationProperties({ConfigProperties.class})
public class AutoConfiguration{
    @Autowired
    private ConfigProperties configProperties;

    @Bean(name ="tyydConfig")
    @ConditionalOnMissingBean
    public TyydConfigurations initConfig()
    {
       return new TyydConfigurations(configProperties.getDataId(),configProperties.getGroupId());
    }
}
